USE [xRepair]
GO

/****** Object:  StoredProcedure [dbo].[UpdateUserPassword]    Script Date: 3/29/2014 10:45:08 AM ******/
DROP PROCEDURE [dbo].[UpdateUserPassword]
GO

/****** Object:  StoredProcedure [dbo].[UpdateUserPassword]    Script Date: 3/29/2014 10:45:08 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[UpdateUserPassword]
	@Username				NVARCHAR(50) = NULL,
	@EmailAddress			NVARCHAR(150) = NULL,
	@NewPassword			NVARCHAR(200),
	@Rowcount				INT = -1 OUTPUT
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    UPDATE [dbo].[Users]
	SET 
       [Password] = @NewPassword      
	WHERE 
		(@Username IS NOT NULL AND [Username] = @Username) OR
		(@EmailAddress IS NOT NULL AND [EmailAddress] = @EmailAddress)

    SELECT @Rowcount = @@ROWCOUNT
END

GO


